package com.thinkgem.jeesite.modules.jdy.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
@Service
public class JdyServiceImpl implements JdyService {
    @Autowired
    private JedisPool jedisPool;
    private Jedis jedis = null;

    @Override
    public String getUrlFromKey(String url) {
        String result=getJedis().get(url);
        return result;
    }

    @Override
    public String getStringFromKey(String key) {
        String result=getJedis().get(key);
        return result;
    }

    @Override
    public Jedis getJedis() {
        if (jedis == null) {
//            jedis = new Jedis("127.0.0.1",6789);
            jedis = jedisPool.getResource();
//            jedis.auth("xldj2*1*7*");
        }
        return jedis;
    }
}
